﻿using System;using System.Windows.Forms;

namespace HighDiveAdmin.GUI.Components
{
    /// <summary>
    /// Control that is to be shown when the divequeue is empty
    /// </summary>
    public partial class RunningContestEndContestGroupBox : UserControl
    {
        /// <summary>
        /// Triggered when the Add Dive button is clicked
        /// </summary>
        public event MethodInvoker EventAddDive;
        /// <summary>
        /// Triggered when the Resume Contest button is clicked
        /// </summary>
        public event MethodInvoker EventResumeContest;
        /// <summary>
        /// Triggered when the End Contest button is clicked
        /// </summary>
        public event MethodInvoker EventEndContest;

        public RunningContestEndContestGroupBox()
        {
            InitializeComponent();
        }

        private void buttonEmptyQueueAddDive_Click(object sender, EventArgs e)
        {
            if (EventAddDive != null)
                EventAddDive();
        }

        private void buttonResumeContest_Click(object sender, EventArgs e)
        {
            if (EventResumeContest != null)
                EventResumeContest();
        }

        private void buttonEndContest_Click(object sender, EventArgs e)
        {
            if (EventEndContest != null)
                EventEndContest();
        }

        #region TabStop
        private void buttonEndContest_TabStopChanged(object sender, EventArgs e)
        {
            foreach (Control control in Controls)
                control.TabStop = TabStop;
        } 
        private void RunningContestEndContestGroupBox_VisibleChanged(object sender, EventArgs e)
        {
            if (Visible)
                buttonEndContest.Focus();
        }
        #endregion

    }
}
